package com.hu.video.service.impl;

import com.hu.video.entity.UserPrivacySettings;
import com.hu.video.mapper.UserPrivacySettingsMapper;
import com.hu.video.service.IUserPrivacySettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserPrivacySettingsServiceImpl implements IUserPrivacySettingsService {
    @Autowired
    private UserPrivacySettingsMapper mapper;

    @Override
    public UserPrivacySettings getByUserId(Long userId) {
        return mapper.selectByUserId(userId);
    }

    @Override
    public void updateSettings(UserPrivacySettings settings) {
        if (mapper.selectByUserId(settings.getUserId()) == null) {
            mapper.insert(settings);
        } else {
            mapper.update(settings);
        }
    }
} 